package designPattern.singleton.lazy;


public class StaticInnerClassSingleton {

    private StaticInnerClassSingleton() {
        //防止反射破坏单例
        if(InnerClassSingleton.INSTANCE != null) {
            throw new RuntimeException("不允许破坏单例！");
        }
    }

    public static StaticInnerClassSingleton getInstance() {
       return InnerClassSingleton.INSTANCE;
    }
    private static class InnerClassSingleton {
        private static final StaticInnerClassSingleton INSTANCE = new StaticInnerClassSingleton();
    }
}
